package com.hitnet.hitnet.pic;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.PopupWindow;

import com.hitnet.hitnet.R;


/**
 *
 * @author Xuanli
 *
 */
public class ActBottomPopWindow extends PopupWindow {
	public ActBottomPopWindow(Context context, final View mMenuView) {
		super(context);	
		// SelectPicPopupWindow View
		this.setContentView(mMenuView);
		// SelectPicPopupWindow width
		this.setWidth(LayoutParams.FILL_PARENT);
		// SelectPicPopupWindow height
		this.setHeight(LayoutParams.WRAP_CONTENT);
		// SelectPicPopupWindow focusable
		this.setFocusable(true);
		// SelectPicPopupWindow animation style
		this.setAnimationStyle(R.style.AnimBottom);
		// ColorDrawable
		ColorDrawable dw = new ColorDrawable(0xb0000000);
		// SelectPicPopupWindow background color
		this.setBackgroundDrawable(dw);
		// mMenuView OnTouchListener
		mMenuView.setOnTouchListener(new OnTouchListener() {

			public boolean onTouch(View v, MotionEvent event) {
//				int maxHeight = mMenuView.findViewById(R.id.bottom).getBottom();
//				int minHeight = mMenuView.findViewById(R.id.bottom).getTop();
//				int y = (int) event.getY();
//				if (event.getAction() == MotionEvent.ACTION_UP) {
//					if (y > maxHeight || y < minHeight) {
//						dismiss();
//					}
//				}
				return true;
			}
		});
	}

}
